package OfferOneHundred;

/**
 * @version: 1.0
 * @Author: wuqiu
 * @date: 2023-06-30 14:04
 * @description: LeetcodeLearnAlgorithm -> OfferOneHundred
 */
public class Q5替换空格 {
    public static void main(String[] args) {
        Q5替换空格 test = new Q5替换空格();
        String s = test.replaceSpace("We are happy.");
        System.out.println(s);
    }

    public String replaceSpace(String s) {
        String ans = s.replace(" ", "%20");
        return ans;
    }

    public String replaceSpace2(String s) {
        String ans = s.replaceAll(" ", "%20");
        return ans;
    }
}
